﻿using System;

namespace MessagePack.Formatters
{
	// Token: 0x0200005D RID: 93
	public class VersionFormatter : IMessagePackFormatter<Version>
	{
		// Token: 0x06000163 RID: 355 RVA: 0x000059F8 File Offset: 0x00003DF8
		private VersionFormatter()
		{
		}

		// Token: 0x06000164 RID: 356 RVA: 0x00005A00 File Offset: 0x00003E00
		public int Serialize(ref byte[] bytes, int offset, Version value, IFormatterResolver formatterResolver)
		{
			if (value == null)
			{
				return MessagePackBinary.WriteNil(ref bytes, offset);
			}
			return MessagePackBinary.WriteString(ref bytes, offset, value.ToString());
		}

		// Token: 0x06000165 RID: 357 RVA: 0x00005A23 File Offset: 0x00003E23
		public Version Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
		{
			if (MessagePackBinary.IsNil(bytes, offset))
			{
				readSize = 1;
				return null;
			}
			return new Version(MessagePackBinary.ReadString(bytes, offset, out readSize));
		}

		// Token: 0x04000052 RID: 82
		public static readonly IMessagePackFormatter<Version> Instance = new VersionFormatter();
	}
}
